<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的博客</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        body {

            font-family: 'Roboto', Arial, sans-serif;
            background-color: #f0f0f0;
            margin: 0;
            padding: 0;
            color: #333;
        }

        header {
            background: linear-gradient(to bottom, #0099ff, #007BFF);
            color: white;
            padding: 10px 0;
            text-align: center;
        }

        nav {
            margin: 10px 0;
            display: flex;
            justify-content: center;
        }

        nav a {
            color: white;
            text-decoration: none;
            margin: 0 15px;
            transition: color 0.3s ease; /* 添加过渡效果，让鼠标悬停时颜色变化更平滑 */
        }

        nav a:hover {
            color: #f0f0f0; /* 鼠标悬停时链接颜色变为浅灰色，与背景形成对比 */
        }

        .container {
            max-width: 800px;
            margin: 20px auto;
            padding: 20px;
            background: white;
            border-radius: 5px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        .article {
            margin-bottom: 30px;
            padding: 15px;
            border-bottom: 1px solid #e2e2e2;
        }

        .article h2 {
            margin: 0;
            font-size: 1.5em;
            border-bottom: 2px solid #007BFF; /* 添加底部边框 */
            padding-bottom: 5px;
        }

        .article p {
            color: #666;
        }

        .search-container {
            margin: 20px 0;
            text-align: center;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .search-input {
            padding: 10px 15px;
            border: 1px solid #ccc;
            border-radius: 20px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            outline: none; /* 去除输入框获取焦点时的默认边框 */
            transition: border-color 0.3s ease; /* 添加边框颜色过渡效果 */
        }

        .search-input:focus {
            border-color: #007BFF; /* 输入框获取焦点时边框颜色变为蓝色 */
        }

        .search-button {
            padding: 10px 15px;
            border: none;
            background-color: #007BFF;
            color: white;
            border-radius: 20px;
            margin-left: 10px;
            cursor: pointer;
            transition: background-color 0.3s ease; /* 添加背景色过渡效果 */
        }

        .search-button:hover {
            background-color: #0099ff; /* 鼠标悬停时按钮背景色变为更深的蓝色 */
        }

        .footer {
            text-align: center;
            margin-top: 20px;
            padding: 10px 0;
            background: linear-gradient(to bottom, #0099ff, #007BFF);
            color: white;
        }

        .social-icons a {
            margin: 0 10px;
            color: white;
            text-decoration: none;
            transition: color 0.3s ease, transform 0.3s ease; /* 添加颜色和变换的过渡效果 */
        }

        .social-icons a:hover {
            color: #f0f0f0; /* 鼠标悬停时图标颜色变为浅灰色 */
            transform: rotate(360deg); /* 鼠标悬停时图标旋转360度 */
        }
    </style>
</head>

<body>
<header>
    <h1>欢迎来到我的博客</h1>
    <nav>
        <div class="nav-links">
            <a href="/index">主页</a>
            <a href="/personalhomepage">个人主页</a>
            <a href="/search.html">搜索文章</a>
        </div>
    </nav>
</header>

<div class="container">
    <div class="article" th:each="article : ${articles}">
        <h2>
            <a th:href="@{/article/{id}(id=${article.article_id})}" th:text="${article.article_title}"></a>
        </h2>
        <p><strong>作者:</strong> <span th:text="${article.articler}"></span></p>
        <p><strong>发布时间:</strong> <span th:text="${article.article_time}"></span></p>
        <p th:text="${article.article_text}" th:truncate="100"></p>
    </div>
    <p th:if="${articles == '暂无文章发布，敬请期待！'}" th:text="${articles}"></p>
</div>

<footer class="footer">
    <p>&copy; 2024 我的博客</p>
</footer>
</body>

</html>